以下是實際的CODE~~!
就不在解釋了
getOrder.php
<?php
require_once('keys.php');
require_once('eBaySession.php');
//SiteID must also be set in the Request's XML
//SiteID = 0 (US) - UK = 3, Canada = 2, Australia = 15, ....
//SiteID Indicates the eBay site to associate the call with
$siteID = 0;
//the call being made:
$verb = 'GetOrders';
$startDate = date('Y-m-d', strtotime("-2 day")) . 'T00:00:01.000Z';
$endDate = date('Y-m-d') . 'T00:00:01.000Z';
$requestXmlBody = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<CreateTimeFrom>$startDate</CreateTimeFrom>
<CreateTimeTo>$endDate</CreateTimeTo>
<OrderRole>Seller</OrderRole>
<OrderStatus>All</OrderStatus>
<RequesterCredentials>
<eBayAuthToken>$userToken</eBayAuthToken>
</RequesterCredentials>
<WarningLevel>High</WarningLevel>
</GetOrdersRequest>
XML;
//Create a new eBay session with all details pulled in from included keys.php
$session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
//send the request and get response
$responseXml = $session->sendHttpRequest($requestXmlBody);
if (stristr($responseXml, 'HTTP 404') || $responseXml == '')
die('<P>Error sending request');
$xml = simplexml_load_string($responseXml);
//var_dump($xml->OrderArray->Order->TransactionArray->Transaction);
$count = count($xml->OrderArray->Order);
//for ($x = 0; $x < $count; $x++):
// var_dump($xml->OrderArray->Order[$x]->TransactionArray->Transaction);
//endfor;
?>
<title>取得訂單列表</title>
<style>
tr:nth-child(odd){
background-color: #999;
}
</style>
<table style="width: 100%;">
<tr>
<th>ebay編號</th>
<th>編號</th>
<th>產品</th>
<th>金額</th>
<th>狀態</th>
<th>詳細</th>
</tr>
<?php for ($x = 0; $x < $count; $x++): ?>
<tr>
<th><?=$xml->OrderArray->Order[$x]->TransactionArray->Transaction->Item->ItemID;?></th>
<th><?=$xml->OrderArray->Order[$x]->TransactionArray->Transaction->ShippingDetails->SellingManagerSalesRecordNumber;?></th>
<th><?=$xml->OrderArray->Order[$x]->TransactionArray->Transaction->Item->SKU;?></th>
<th><?=$xml->OrderArray->Order[$x]->TransactionArray->Transaction->TransactionPrice;?></th>
<th><?=$xml->OrderArray->Order[$x]->OrderStatus;?></th>
<th><input type="button" value="詳細內容" onclick="window.location.href='order_content.php?order_id=<?=$xml->OrderArray->Order[$x]->OrderID;?>'"></th>
</tr>
<?php endfor; ?>
</table>